1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module glib.Date; 26 27 private import glib.ConstructionException; 28 private import glib.MemorySlice; 29 private import glib.Str; 30 private import glib.TimeVal; 31 private import glib.c.functions; 32 public import glib.c.types; 33 private import linker.Loader; 34 35 36 /** 37 * Represents a day between January 1, Year 1 and a few thousand years in 38 * the future. None of its members should be accessed directly. 39 * 40 * If the `GDate` is obtained from g_date_new(), it will be safe 41 * to mutate but invalid and thus not safe for calendrical computations. 42 * 43 * If it's declared on the stack, it will contain garbage so must be 44 * initialized with g_date_clear(). g_date_clear() makes the date invalid 45 * but safe. An invalid date doesn't represent a day, it's "empty." A date 46 * becomes valid after you set it to a Julian day or you set a day, month, 47 * and year. 48 */ 49 public final class Date 50 { 51 /** the main Gtk struct */ 52 protected GDate* gDate; 53 protected bool ownedRef; 54 55 /** Get the main Gtk struct */ 56 public GDate* getDateStruct(bool transferOwnership = false) 57 { 58 if (transferOwnership) 59 ownedRef = false; 60 return gDate; 61 } 62 63 /** the main Gtk struct as a void* */ 64 protected void* getStruct() 65 { 66 return cast(void*)gDate; 67 } 68 69 /** 70 * Sets our main struct and passes it to the parent class. 71 */ 72 public this (GDate* gDate, bool ownedRef = false) 73 { 74 this.gDate = gDate; 75 this.ownedRef = ownedRef; 76 } 77 78 ~this () 79 { 80 if ( Linker.isLoaded(LIBRARY_GLIB[0]) && ownedRef ) 81 g_date_free(gDate); 82 } 83 84 85 /** 86 * the Julian representation of the date 87 */ 88 public @property uint julianDays() 89 { 90 return gDate.julianDays; 91 } 92 93 /** Ditto */ 94 public @property void julianDays(uint value) 95 { 96 gDate.julianDays = value; 97 } 98 99 /** 100 * this bit is set if @julian_days is valid 101 */ 102 public @property uint julian() 103 { 104 return gDate.julian; 105 } 106 107 /** Ditto */ 108 public @property void julian(uint value) 109 { 110 gDate.julian = value; 111 } 112 113 /** 114 * this is set if @day, @month and @year are valid 115 */ 116 public @property uint dmy() 117 { 118 return gDate.dmy; 119 } 120 121 /** Ditto */ 122 public @property void dmy(uint value) 123 { 124 gDate.dmy = value; 125 } 126 127 /** 128 * the day of the day-month-year representation of the date, 129 * as a number between 1 and 31 130 */ 131 public @property uint day() 132 { 133 return gDate.day; 134 } 135 136 /** Ditto */ 137 public @property void day(uint value) 138 { 139 gDate.day = value; 140 } 141 142 /** 143 * the day of the day-month-year representation of the date, 144 * as a number between 1 and 12 145 */ 146 public @property uint month() 147 { 148 return gDate.month; 149 } 150 151 /** Ditto */ 152 public @property void month(uint value) 153 { 154 gDate.month = value; 155 } 156 157 /** 158 * the day of the day-month-year representation of the date 159 */ 160 public @property uint year() 161 { 162 return gDate.year; 163 } 164 165 /** Ditto */ 166 public @property void year(uint value) 167 { 168 gDate.year = value; 169 } 170 171 /** 172 * Allocates a #GDate and initializes 173 * it to a safe state. The new date will 174 * be cleared (as if you'd called g_date_clear()) but invalid (it won't 175 * represent an existing day). Free the return value with g_date_free(). 176 * 177 * Returns: a newly-allocated #GDate 178 * 179 * Throws: ConstructionException GTK+ fails to create the object. 180 */ 181 public this() 182 { 183 auto __p = g_date_new(); 184 185 if(__p is null) 186 { 187 throw new ConstructionException("null returned by new"); 188 } 189 190 this(cast(GDate*) __p); 191 } 192 193 /** 194 * Create a new #GDate representing the given day-month-year triplet. 195 * 196 * The triplet you pass in must represent a valid date. Use g_date_valid_dmy() 197 * if needed to validate it. The returned #GDate is guaranteed to be non-%NULL 198 * and valid. 199 * 200 * Params: 201 * day = day of the month 202 * month = month of the year 203 * year = year 204 * 205 * Returns: a newly-allocated #GDate 206 * initialized with @day, @month, and @year 207 * 208 * Throws: ConstructionException GTK+ fails to create the object. 209 */ 210 public this(GDateDay day, GDateMonth month, GDateYear year) 211 { 212 auto __p = g_date_new_dmy(day, month, year); 213 214 if(__p is null) 215 { 216 throw new ConstructionException("null returned by new_dmy"); 217 } 218 219 this(cast(GDate*) __p); 220 } 221 222 /** 223 * Create a new #GDate representing the given Julian date. 224 * 225 * The @julian_day you pass in must be valid. Use g_date_valid_julian() if 226 * needed to validate it. The returned #GDate is guaranteed to be non-%NULL and 227 * valid. 228 * 229 * Params: 230 * julianDay = days since January 1, Year 1 231 * 232 * Returns: a newly-allocated #GDate initialized 233 * with @julian_day 234 * 235 * Throws: ConstructionException GTK+ fails to create the object. 236 */ 237 public this(uint julianDay) 238 { 239 auto __p = g_date_new_julian(julianDay); 240 241 if(__p is null) 242 { 243 throw new ConstructionException("null returned by new_julian"); 244 } 245 246 this(cast(GDate*) __p); 247 } 248 249 /** 250 * Increments a date some number of days. 251 * To move forward by weeks, add weeks*7 days. 252 * The date must be valid. 253 * 254 * Params: 255 * nDays = number of days to move the date forward 256 */ 257 public void addDays(uint nDays) 258 { 259 g_date_add_days(gDate, nDays); 260 } 261 262 /** 263 * Increments a date by some number of months. 264 * If the day of the month is greater than 28, 265 * this routine may change the day of the month 266 * (because the destination month may not have 267 * the current day in it). The date must be valid. 268 * 269 * Params: 270 * nMonths = number of months to move forward 271 */ 272 public void addMonths(uint nMonths) 273 { 274 g_date_add_months(gDate, nMonths); 275 } 276 277 /** 278 * Increments a date by some number of years. 279 * If the date is February 29, and the destination 280 * year is not a leap year, the date will be changed 281 * to February 28. The date must be valid. 282 * 283 * Params: 284 * nYears = number of years to move forward 285 */ 286 public void addYears(uint nYears) 287 { 288 g_date_add_years(gDate, nYears); 289 } 290 291 /** 292 * If @date is prior to @min_date, sets @date equal to @min_date. 293 * If @date falls after @max_date, sets @date equal to @max_date. 294 * Otherwise, @date is unchanged. 295 * Either of @min_date and @max_date may be %NULL. 296 * All non-%NULL dates must be valid. 297 * 298 * Params: 299 * minDate = minimum accepted value for @date 300 * maxDate = maximum accepted value for @date 301 */ 302 public void clamp(Date minDate, Date maxDate) 303 { 304 g_date_clamp(gDate, (minDate is null) ? null : minDate.getDateStruct(), (maxDate is null) ? null : maxDate.getDateStruct()); 305 } 306 307 /** 308 * Initializes one or more #GDate structs to a safe but invalid 309 * state. The cleared dates will not represent an existing date, but will 310 * not contain garbage. Useful to init a date declared on the stack. 311 * Validity can be tested with g_date_valid(). 312 * 313 * Params: 314 * nDates = number of dates to clear 315 */ 316 public void clear(uint nDates) 317 { 318 g_date_clear(gDate, nDates); 319 } 320 321 /** 322 * qsort()-style comparison function for dates. 323 * Both dates must be valid. 324 * 325 * Params: 326 * rhs = second date to compare 327 * 328 * Returns: 0 for equal, less than zero if @lhs is less than @rhs, 329 * greater than zero if @lhs is greater than @rhs 330 */ 331 public int compare(Date rhs) 332 { 333 return g_date_compare(gDate, (rhs is null) ? null : rhs.getDateStruct()); 334 } 335 336 /** 337 * Copies a GDate to a newly-allocated GDate. If the input was invalid 338 * (as determined by g_date_valid()), the invalid state will be copied 339 * as is into the new object. 340 * 341 * Returns: a newly-allocated #GDate initialized from @date 342 * 343 * Since: 2.56 344 */ 345 public Date copy() 346 { 347 auto __p = g_date_copy(gDate); 348 349 if(__p is null) 350 { 351 return null; 352 } 353 354 return new Date(cast(GDate*) __p, true); 355 } 356 357 /** 358 * Computes the number of days between two dates. 359 * If @date2 is prior to @date1, the returned value is negative. 360 * Both dates must be valid. 361 * 362 * Params: 363 * date2 = the second date 364 * 365 * Returns: the number of days between @date1 and @date2 366 */ 367 public int daysBetween(Date date2) 368 { 369 return g_date_days_between(gDate, (date2 is null) ? null : date2.getDateStruct()); 370 } 371 372 /** 373 * Frees a #GDate returned from g_date_new(). 374 */ 375 public void free() 376 { 377 g_date_free(gDate); 378 ownedRef = false; 379 } 380 381 /** 382 * Returns the day of the month. The date must be valid. 383 * 384 * Returns: day of the month 385 */ 386 public GDateDay getDay() 387 { 388 return g_date_get_day(gDate); 389 } 390 391 /** 392 * Returns the day of the year, where Jan 1 is the first day of the 393 * year. The date must be valid. 394 * 395 * Returns: day of the year 396 */ 397 public uint getDayOfYear() 398 { 399 return g_date_get_day_of_year(gDate); 400 } 401 402 /** 403 * Returns the week of the year, where weeks are interpreted according 404 * to ISO 8601. 405 * 406 * Returns: ISO 8601 week number of the year. 407 * 408 * Since: 2.6 409 */ 410 public uint getIso8601WeekOfYear() 411 { 412 return g_date_get_iso8601_week_of_year(gDate); 413 } 414 415 /** 416 * Returns the Julian day or "serial number" of the #GDate. The 417 * Julian day is simply the number of days since January 1, Year 1; i.e., 418 * January 1, Year 1 is Julian day 1; January 2, Year 1 is Julian day 2, 419 * etc. The date must be valid. 420 * 421 * Returns: Julian day 422 */ 423 public uint getJulian() 424 { 425 return g_date_get_julian(gDate); 426 } 427 428 /** 429 * Returns the week of the year, where weeks are understood to start on 430 * Monday. If the date is before the first Monday of the year, return 0. 431 * The date must be valid. 432 * 433 * Returns: week of the year 434 */ 435 public uint getMondayWeekOfYear() 436 { 437 return g_date_get_monday_week_of_year(gDate); 438 } 439 440 /** 441 * Returns the month of the year. The date must be valid. 442 * 443 * Returns: month of the year as a #GDateMonth 444 */ 445 public GDateMonth getMonth() 446 { 447 return g_date_get_month(gDate); 448 } 449 450 /** 451 * Returns the week of the year during which this date falls, if 452 * weeks are understood to begin on Sunday. The date must be valid. 453 * Can return 0 if the day is before the first Sunday of the year. 454 * 455 * Returns: week number 456 */ 457 public uint getSundayWeekOfYear() 458 { 459 return g_date_get_sunday_week_of_year(gDate); 460 } 461 462 /** 463 * Returns the day of the week for a #GDate. The date must be valid. 464 * 465 * Returns: day of the week as a #GDateWeekday. 466 */ 467 public GDateWeekday getWeekday() 468 { 469 return g_date_get_weekday(gDate); 470 } 471 472 /** 473 * Returns the year of a #GDate. The date must be valid. 474 * 475 * Returns: year in which the date falls 476 */ 477 public GDateYear getYear() 478 { 479 return g_date_get_year(gDate); 480 } 481 482 /** 483 * Returns %TRUE if the date is on the first of a month. 484 * The date must be valid. 485 * 486 * Returns: %TRUE if the date is the first of the month 487 */ 488 public bool isFirstOfMonth() 489 { 490 return g_date_is_first_of_month(gDate) != 0; 491 } 492 493 /** 494 * Returns %TRUE if the date is the last day of the month. 495 * The date must be valid. 496 * 497 * Returns: %TRUE if the date is the last day of the month 498 */ 499 public bool isLastOfMonth() 500 { 501 return g_date_is_last_of_month(gDate) != 0; 502 } 503 504 /** 505 * Checks if @date1 is less than or equal to @date2, 506 * and swap the values if this is not the case. 507 * 508 * Params: 509 * date2 = the second date 510 */ 511 public void order(Date date2) 512 { 513 g_date_order(gDate, (date2 is null) ? null : date2.getDateStruct()); 514 } 515 516 /** 517 * Sets the day of the month for a #GDate. If the resulting 518 * day-month-year triplet is invalid, the date will be invalid. 519 * 520 * Params: 521 * day = day to set 522 */ 523 public void setDay(GDateDay day) 524 { 525 g_date_set_day(gDate, day); 526 } 527 528 /** 529 * Sets the value of a #GDate from a day, month, and year. 530 * The day-month-year triplet must be valid; if you aren't 531 * sure it is, call g_date_valid_dmy() to check before you 532 * set it. 533 * 534 * Params: 535 * day = day 536 * month = month 537 * y = year 538 */ 539 public void setDmy(GDateDay day, GDateMonth month, GDateYear y) 540 { 541 g_date_set_dmy(gDate, day, month, y); 542 } 543 544 /** 545 * Sets the value of a #GDate from a Julian day number. 546 * 547 * Params: 548 * julianDate = Julian day number (days since January 1, Year 1) 549 */ 550 public void setJulian(uint julianDate) 551 { 552 g_date_set_julian(gDate, julianDate); 553 } 554 555 /** 556 * Sets the month of the year for a #GDate. If the resulting 557 * day-month-year triplet is invalid, the date will be invalid. 558 * 559 * Params: 560 * month = month to set 561 */ 562 public void setMonth(GDateMonth month) 563 { 564 g_date_set_month(gDate, month); 565 } 566 567 /** 568 * Parses a user-inputted string @str, and try to figure out what date it 569 * represents, taking the [current locale][setlocale] into account. If the 570 * string is successfully parsed, the date will be valid after the call. 571 * Otherwise, it will be invalid. You should check using g_date_valid() 572 * to see whether the parsing succeeded. 573 * 574 * This function is not appropriate for file formats and the like; it 575 * isn't very precise, and its exact behavior varies with the locale. 576 * It's intended to be a heuristic routine that guesses what the user 577 * means by a given string (and it does work pretty well in that 578 * capacity). 579 * 580 * Params: 581 * str = string to parse 582 */ 583 public void setParse(string str) 584 { 585 g_date_set_parse(gDate, Str.toStringz(str)); 586 } 587 588 /** 589 * Sets the value of a date from a #GTime value. 590 * The time to date conversion is done using the user's current timezone. 591 * 592 * Deprecated: Use g_date_set_time_t() instead. 593 * 594 * Params: 595 * time = #GTime value to set. 596 */ 597 public void setTime(GTime time) 598 { 599 g_date_set_time(gDate, time); 600 } 601 602 /** 603 * Sets the value of a date to the date corresponding to a time 604 * specified as a time_t. The time to date conversion is done using 605 * the user's current timezone. 606 * 607 * To set the value of a date to the current day, you could write: 608 * |[<!-- language="C" --> 609 * time_t now = time (NULL); 610 * if (now == (time_t) -1) 611 * // handle the error 612 * g_date_set_time_t (date, now); 613 * ]| 614 * 615 * Params: 616 * timet = time_t value to set 617 * 618 * Since: 2.10 619 */ 620 public void set_time_t(uint timet) 621 { 622 g_date_set_time_t(gDate, timet); 623 } 624 625 /** 626 * Sets the value of a date from a #GTimeVal value. Note that the 627 * @tv_usec member is ignored, because #GDate can't make use of the 628 * additional precision. 629 * 630 * The time to date conversion is done using the user's current timezone. 631 * 632 * Deprecated: #GTimeVal is not year-2038-safe. Use g_date_set_time_t() 633 * instead. 634 * 635 * Params: 636 * timeval = #GTimeVal value to set 637 * 638 * Since: 2.10 639 */ 640 public void setTimeVal(TimeVal timeval) 641 { 642 g_date_set_time_val(gDate, (timeval is null) ? null : timeval.getTimeValStruct()); 643 } 644 645 /** 646 * Sets the year for a #GDate. If the resulting day-month-year 647 * triplet is invalid, the date will be invalid. 648 * 649 * Params: 650 * year = year to set 651 */ 652 public void setYear(GDateYear year) 653 { 654 g_date_set_year(gDate, year); 655 } 656 657 /** 658 * Moves a date some number of days into the past. 659 * To move by weeks, just move by weeks*7 days. 660 * The date must be valid. 661 * 662 * Params: 663 * nDays = number of days to move 664 */ 665 public void subtractDays(uint nDays) 666 { 667 g_date_subtract_days(gDate, nDays); 668 } 669 670 /** 671 * Moves a date some number of months into the past. 672 * If the current day of the month doesn't exist in 673 * the destination month, the day of the month 674 * may change. The date must be valid. 675 * 676 * Params: 677 * nMonths = number of months to move 678 */ 679 public void subtractMonths(uint nMonths) 680 { 681 g_date_subtract_months(gDate, nMonths); 682 } 683 684 /** 685 * Moves a date some number of years into the past. 686 * If the current day doesn't exist in the destination 687 * year (i.e. it's February 29 and you move to a non-leap-year) 688 * then the day is changed to February 29. The date 689 * must be valid. 690 * 691 * Params: 692 * nYears = number of years to move 693 */ 694 public void subtractYears(uint nYears) 695 { 696 g_date_subtract_years(gDate, nYears); 697 } 698 699 /** 700 * Fills in the date-related bits of a struct tm using the @date value. 701 * Initializes the non-date parts with something safe but meaningless. 702 * 703 * Params: 704 * tm = struct tm to fill 705 */ 706 public void toStructTm(void* tm) 707 { 708 g_date_to_struct_tm(gDate, tm); 709 } 710 711 /** 712 * Returns %TRUE if the #GDate represents an existing day. The date must not 713 * contain garbage; it should have been initialized with g_date_clear() 714 * if it wasn't allocated by one of the g_date_new() variants. 715 * 716 * Returns: Whether the date is valid 717 */ 718 public bool valid() 719 { 720 return g_date_valid(gDate) != 0; 721 } 722 723 /** 724 * Returns the number of days in a month, taking leap 725 * years into account. 726 * 727 * Params: 728 * month = month 729 * year = year 730 * 731 * Returns: number of days in @month during the @year 732 */ 733 public static ubyte getDaysInMonth(GDateMonth month, GDateYear year) 734 { 735 return g_date_get_days_in_month(month, year); 736 } 737 738 /** 739 * Returns the number of weeks in the year, where weeks 740 * are taken to start on Monday. Will be 52 or 53. The 741 * date must be valid. (Years always have 52 7-day periods, 742 * plus 1 or 2 extra days depending on whether it's a leap 743 * year. This function is basically telling you how many 744 * Mondays are in the year, i.e. there are 53 Mondays if 745 * one of the extra days happens to be a Monday.) 746 * 747 * Params: 748 * year = a year 749 * 750 * Returns: number of Mondays in the year 751 */ 752 public static ubyte getMondayWeeksInYear(GDateYear year) 753 { 754 return g_date_get_monday_weeks_in_year(year); 755 } 756 757 /** 758 * Returns the number of weeks in the year, where weeks 759 * are taken to start on Sunday. Will be 52 or 53. The 760 * date must be valid. (Years always have 52 7-day periods, 761 * plus 1 or 2 extra days depending on whether it's a leap 762 * year. This function is basically telling you how many 763 * Sundays are in the year, i.e. there are 53 Sundays if 764 * one of the extra days happens to be a Sunday.) 765 * 766 * Params: 767 * year = year to count weeks in 768 * 769 * Returns: the number of weeks in @year 770 */ 771 public static ubyte getSundayWeeksInYear(GDateYear year) 772 { 773 return g_date_get_sunday_weeks_in_year(year); 774 } 775 776 /** 777 * Returns %TRUE if the year is a leap year. 778 * 779 * For the purposes of this function, leap year is every year 780 * divisible by 4 unless that year is divisible by 100. If it 781 * is divisible by 100 it would be a leap year only if that year 782 * is also divisible by 400. 783 * 784 * Params: 785 * year = year to check 786 * 787 * Returns: %TRUE if the year is a leap year 788 */ 789 public static bool isLeapYear(GDateYear year) 790 { 791 return g_date_is_leap_year(year) != 0; 792 } 793 794 /** 795 * Generates a printed representation of the date, in a 796 * [locale][setlocale]-specific way. 797 * Works just like the platform's C library strftime() function, 798 * but only accepts date-related formats; time-related formats 799 * give undefined results. Date must be valid. Unlike strftime() 800 * (which uses the locale encoding), works on a UTF-8 format 801 * string and stores a UTF-8 result. 802 * 803 * This function does not provide any conversion specifiers in 804 * addition to those implemented by the platform's C library. 805 * For example, don't expect that using g_date_strftime() would 806 * make the \%F provided by the C99 strftime() work on Windows 807 * where the C library only complies to C89. 808 * 809 * Params: 810 * s = destination buffer 811 * slen = buffer size 812 * format = format string 813 * date = valid #GDate 814 * 815 * Returns: number of characters written to the buffer, or 0 the buffer was too small 816 */ 817 public static size_t strftime(string s, size_t slen, string format, Date date) 818 { 819 return g_date_strftime(Str.toStringz(s), slen, Str.toStringz(format), (date is null) ? null : date.getDateStruct()); 820 } 821 822 /** 823 * Returns %TRUE if the day of the month is valid (a day is valid if it's 824 * between 1 and 31 inclusive). 825 * 826 * Params: 827 * day = day to check 828 * 829 * Returns: %TRUE if the day is valid 830 */ 831 public static bool validDay(GDateDay day) 832 { 833 return g_date_valid_day(day) != 0; 834 } 835 836 /** 837 * Returns %TRUE if the day-month-year triplet forms a valid, existing day 838 * in the range of days #GDate understands (Year 1 or later, no more than 839 * a few thousand years in the future). 840 * 841 * Params: 842 * day = day 843 * month = month 844 * year = year 845 * 846 * Returns: %TRUE if the date is a valid one 847 */ 848 public static bool validDmy(GDateDay day, GDateMonth month, GDateYear year) 849 { 850 return g_date_valid_dmy(day, month, year) != 0; 851 } 852 853 /** 854 * Returns %TRUE if the Julian day is valid. Anything greater than zero 855 * is basically a valid Julian, though there is a 32-bit limit. 856 * 857 * Params: 858 * julianDate = Julian day to check 859 * 860 * Returns: %TRUE if the Julian day is valid 861 */ 862 public static bool validJulian(uint julianDate) 863 { 864 return g_date_valid_julian(julianDate) != 0; 865 } 866 867 /** 868 * Returns %TRUE if the month value is valid. The 12 #GDateMonth 869 * enumeration values are the only valid months. 870 * 871 * Params: 872 * month = month 873 * 874 * Returns: %TRUE if the month is valid 875 */ 876 public static bool validMonth(GDateMonth month) 877 { 878 return g_date_valid_month(month) != 0; 879 } 880 881 /** 882 * Returns %TRUE if the weekday is valid. The seven #GDateWeekday enumeration 883 * values are the only valid weekdays. 884 * 885 * Params: 886 * weekday = weekday 887 * 888 * Returns: %TRUE if the weekday is valid 889 */ 890 public static bool validWeekday(GDateWeekday weekday) 891 { 892 return g_date_valid_weekday(weekday) != 0; 893 } 894 895 /** 896 * Returns %TRUE if the year is valid. Any year greater than 0 is valid, 897 * though there is a 16-bit limit to what #GDate will understand. 898 * 899 * Params: 900 * year = year 901 * 902 * Returns: %TRUE if the year is valid 903 */ 904 public static bool validYear(GDateYear year) 905 { 906 return g_date_valid_year(year) != 0; 907 } 908 }